package com.chilli.cosima.service;

import java.util.List;
import java.util.Map;

import com.chilli.cosima.common.BussinessException;
import com.chilli.cosima.data.bean.TOperator;
import com.chilli.cosima.data.bean.TPower;
import com.chilli.cosima.data.bean.TPowerRole;
import com.chilli.cosima.data.bean.TRole;

public interface UserService
{

	// 创建用户
	public Long createUser(TOperator user) throws BussinessException;

	// 修改用户
	public void updateUser(TOperator user) throws BussinessException;

	// 删除用户
	public void deleteUser(Long[] id) throws BussinessException;

	// 查询所有用户
	public List<TOperator> findUserAll();

	// 按Id查询
	public Object findUserById(Long id);

	public List<TOperator> findUserByRoleId(Long roleId);

	// 用户登陆
	public TOperator findUserByName(String username);

	// 按条件分页查询
	@SuppressWarnings("unchecked")
	public Map findUserByPage(int current, int pageSize);

	// 按条件分页查询
	@SuppressWarnings("unchecked")
	public Map findRoleByPage(int current, int pageSize);

	public List<TRole> findAllRoles();

	public String findRoleNameById(long roleid);

	public TRole findRoleById(long roleid);

	public TRole findRoleByName(String rolename);

	public List<TPower> findAllPowers();

	public List<String> getPowerTreeList();

	public void clearPowerTreeList();

	public void clearUpdatePowerTreeList();

	public void createTree(String fatherid, List<TPower> powerlist);

	public Long createRole(TRole role) throws BussinessException;

	public Long createPowerRole(TPowerRole powerrole) throws BussinessException;

	public void createRoleSavePower(TRole role, String[] testCheck)
			throws BussinessException;

	public void deleteRole(Long[] id) throws BussinessException;

	public void deleteRolePower(Long[] id) throws BussinessException;

	public void deleteRoleAndPower(Long[] id) throws BussinessException;

	public void updateRole(TRole role) throws BussinessException;

	public List<TPowerRole> findRolePowerByRoleId(Long roleid)
			throws BussinessException;

	public List<String> getUpdatePowerTreeList();

	public void updateTree(String fatherid, List<TPowerRole> optpowerlist,
			List<TPower> powerlist);
}
